package com.shangcheng.controller;

import com.shangcheng.common.Result;
import com.shangcheng.entity.TProduct;
import com.shangcheng.service.ProductServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class AddProductController {
    @Autowired
    private ProductServiceImpl productservice;
    @PostMapping("/products")
    public Result<Integer> addProduct(@RequestBody TProduct product) {
        productservice.addProduct(product);
        return Result.ok(product.getId());
    }

}
